package com.tudouji.project.copy.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.copy.domain.DataexStopedtrans;
import com.tudouji.project.copy.service.IDataexStopedtransService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 拉取失败数据Controller
 * 
 * @author tudouji
 * @date 2022-05-24
 */
@RestController
@RequestMapping("/copy/stopedtrans")
public class DataexStopedtransController extends BaseController
{
    @Autowired
    private IDataexStopedtransService dataexStopedtransService;

    /**
     * 查询拉取失败数据列表
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataexStopedtrans dataexStopedtrans)
    {
        startPage();
        List<DataexStopedtrans> list = dataexStopedtransService.selectDataexStopedtransList(dataexStopedtrans);
        return getDataTable(list);
    }

    /**
     * 导出拉取失败数据列表
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:export')")
    @Log(title = "拉取失败数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(DataexStopedtrans dataexStopedtrans)
    {
        List<DataexStopedtrans> list = dataexStopedtransService.selectDataexStopedtransList(dataexStopedtrans);
        ExcelUtil<DataexStopedtrans> util = new ExcelUtil<DataexStopedtrans>(DataexStopedtrans.class);
        return util.exportExcel(list, "stopedtrans");
    }

    /**
     * 获取拉取失败数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(dataexStopedtransService.selectDataexStopedtransById(id));
    }

    /**
     * 新增拉取失败数据
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:add')")
    @Log(title = "拉取失败数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataexStopedtrans dataexStopedtrans)
    {
        return toAjax(dataexStopedtransService.insertDataexStopedtrans(dataexStopedtrans));
    }

    /**
     * 修改拉取失败数据
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:edit')")
    @Log(title = "拉取失败数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataexStopedtrans dataexStopedtrans)
    {
        return toAjax(dataexStopedtransService.updateDataexStopedtrans(dataexStopedtrans));
    }

    /**
     * 删除拉取失败数据
     */
    @PreAuthorize("@ss.hasPermi('copy:stopedtrans:remove')")
    @Log(title = "拉取失败数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dataexStopedtransService.deleteDataexStopedtransByIds(ids));
    }
}
